package com.nwpu.intimacy.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Socket;

import com.nwpu.intimacy.main.MainActivity;

import android.util.Log;

public class ReceiveThread extends Thread {

	private Socket hostsocket;

	public ReceiveThread(Socket socket) {
		super();
		this.hostsocket = socket;
	}

	public void run() {
		try {

			InputStream cin = hostsocket.getInputStream();
			BufferedReader br = new BufferedReader(new InputStreamReader(cin));
			String str = br.readLine();
			MainActivity.getMessage(str);

			Log.e("FriendMessage", str);

			cin.close();
			hostsocket.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
